package com.test07_继承与多态;

/**
 * 覆写
 */
public class YootkDemo_02 {

    public static void main(String[] args) {
        MathBook2 book = new MathBook2();
        System.out.println(book.getInfo());
        book.print();
    }
}

class Book2 {
    String message = "沐言科技：www.yootk.com";

    public String getInfo() {
        return "【Book类】这是一本普通的图书";
    }
}

class MathBook2 extends Book2 {
    int message = 100;  // 变量名称相同，类型不同

    public String getInfo() {
        return "【MathBook】这是一本学习数学知识的图书";
    }

    public void print() {
        System.out.println("【Book】message = " + super.message);
        System.out.println("【MathBook】message = " + this.message);
    }
}
